home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Vypalování CD
/
Vypalovani-CD-cd1.bin
/
Backup-Burner Add-On SDK 5.0
/
ExampleSource
/
C#
/
CallingBB.cs
Wrap
Text File
|
2002-03-23
|
3KB
|
79 lines
// ----------------------------------------------------------------------------
//
// Project File: CallingBB.cs
// A partial program that uses DllImport to access MakeBackupCD from BackupBurner.dll.
// As compared to C++, this particular solution doesn't allow for Dynamic binding of the DLL,
// although it works if you're sure the dll is going to be in the same place.
//
// *Edit the path value before compiling.
//
// Demo for use with Backup-Burner Add-on SDK
// February, 2002
// ⌐Desernet Broadband Media, Inc.
// Produced by: D. Clark
// C# port courtesy Michael Malinak.
// Should compile in Visual C# without errors.
//
// ----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace CSBackupBurner
{
public class BackupBurner
{
// Get function reference into DLL
[DllImport(@"C:\myprogpath\Bin\BackupBurner.dll")]
public extern static int MakeBackupCD(
[MarshalAs(UnmanagedType.LPArray)] byte[] szBBRegName,
[MarshalAs(UnmanagedType.LPArray)] byte[] szBBRegCode,
[MarshalAs(UnmanagedType.LPArray)] byte[] szBBVolume,
[MarshalAs(UnmanagedType.LPArray)] byte[] szBBTitle,
[MarshalAs(UnmanagedType.LPArray)] byte[] szBBColorForm,
[MarshalAs(UnmanagedType.LPArray)] byte[] szBBColorText,
[MarshalAs(UnmanagedType.LPArray)] byte[] szPathtoBackupFolder,
[MarshalAs(UnmanagedType.LPArray)] byte[] szBBFutureUse);
BackupBurner()
{}
public int BurnCD()
{
byte[] szBBRegName = new byte[32];
byte[] szBBRegCode = new byte[512];
byte[] szBBVolume = new byte[16];
byte[] szBBTitle = new byte[128];
byte[] szBBColorForm = new byte[32];
byte[] szBBColorText = new byte[32];
byte[] szPathtoBackupFolder = new byte[512];
byte[] szBBFutureUse = new byte[512];
Encoding.ASCII.GetBytes("DEMOUSER").CopyTo(szBBRegName,0);
Encoding.ASCII.GetBytes("ABCD1234").CopyTo(szBBRegCode,0);
Encoding.ASCII.GetBytes("MyBackupCD").CopyTo(szBBVolume,0);
Encoding.ASCII.GetBytes("My Project's Name is __").CopyTo(szBBTitle,0);
Encoding.ASCII.GetBytes("clSilver").CopyTo(szBBColorForm,0);
Encoding.ASCII.GetBytes("clBlack").CopyTo(szBBColorText,0);
Encoding.ASCII.GetBytes(@"C:\myprogpath\FilesToBackup\").CopyTo(szPathtoBackupFolder,0);
Encoding.ASCII.GetBytes("").CopyTo(szBBFutureUse,0);
int result = MakeBackupCD(
szBBRegName,
szBBRegCode,
szBBVolume,
szBBTitle,
szBBColorForm,
szBBColorText,
szPathtoBackupFolder,
szBBFutureUse);
return result;
}
}
}